﻿<!DOCTYPE HTML>
<!-- saved from url=(0076)http://172.13.19.31:6060/note_html/数据库/Redis/1001020-数据结构-string.html -->
<!DOCTYPE html PUBLIC "" ""><HTML><HEAD><META content="IE=11.0000" 
http-equiv="X-UA-Compatible">
 
<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
<TITLE>数据结构-string</TITLE> <LINK href="数据结构-string_files/standalone.css" rel="stylesheet"> 
<LINK href="数据结构-string_files/overlay-apple.css" rel="stylesheet"> <LINK href="数据结构-string_files/article_edit.css" 
rel="stylesheet"> 
<STYLE type="text/css">
	#content{
		margin: 5px 10px;
	}
</STYLE>
	 <!-- 代码高亮 -->	 <LINK href="数据结构-string_files/shCoreEclipse.css" rel="stylesheet">
	 <LINK href="数据结构-string_files/my-highlighter.css" rel="stylesheet"> 
<META name="GENERATOR" content="MSHTML 11.00.10586.545"></HEAD> 
<BODY>
<DIV id="content">
<H1 align="center">数据结构-string</H1>
<P align="right" 
style="margin: 0px 10px 0px 0px; padding: 0px;">最后修改时间：2016-04-22 20:47:04</P>
<HR style="border-width: 2px; border-color: lime;">

<H3>语法</H3>
<PRE class="brush: bash;">redis 127.0.0.1:6379&gt; COMMAND KEY_NAME

#示例
redis 127.0.0.1:6379&gt; SET yiibai redis
OK
redis 127.0.0.1:6379&gt; GET yiibai
"redis"
</PRE>
<H3>Redis字符串命令</H3>
<TABLE class="src" style='border-color: rgb(214, 214, 214); width: 604px; color: rgb(49, 49, 49); line-height: 22px; font-family: "Open Sans", Arial, sans-serif; font-size: 14px; margin-top: 8px; margin-bottom: 8px; vertical-align: top; border-collapse: collapse; box-sizing: border-box; border-spacing: 0px; background-color: rgb(247, 247, 247);'>
  <TBODY style="box-sizing: border-box;">
  <TR style="box-sizing: border-box;">
    <TH style="background: rgb(238, 238, 238); border-color: rgb(214, 214, 214); padding: 5px; width: 38px; border-collapse: collapse; box-sizing: border-box;">S.N.</TH>
    <TH style="background: rgb(238, 238, 238); border-color: rgb(214, 214, 214); padding: 5px; border-collapse: collapse; box-sizing: border-box;">命令 
      &amp; 描述</TH></TR>
  <TR>
    <TD>1</TD>
    <TD>      SET key value&nbsp;<BR>此命令用于在指定键设置值</TD></TR>
  <TR>
    <TD>2</TD>
    <TD>      GET key&nbsp;<BR>键对应的值。</TD></TR>
  <TR>
    <TD>3</TD>
    <TD>      GETRANGE key start end&nbsp;<BR>得到字符串的子字符串存放在一个键</TD></TR>
  <TR>
    <TD>4</TD>
    <TD>      GETSET key value<BR>设置键的字符串值，并返回旧值</TD></TR>
  <TR>
    <TD>5</TD>
    <TD>      GETBIT key offset<BR>返回存储在键位值的字符串值的偏移</TD></TR>
  <TR>
    <TD>6</TD>
    <TD>      MGET key1 [key2..]<BR>得到所有的给定键的值</TD></TR>
  <TR>
    <TD>7</TD>
    <TD>      SETBIT key offset value<BR>设置或清除该位在存储在键的字符串值偏移</TD></TR>
  <TR>
    <TD>8</TD>
    <TD>      SETEX key seconds value<BR>键到期时设置值</TD></TR>
  <TR>
    <TD>9</TD>
    <TD>      SETNX key value<BR>设置键的值，只有当该键不存在</TD></TR>
  <TR>
    <TD>10</TD>
    <TD>      SETRANGE key offset value<BR>覆盖字符串的一部分从指定键的偏移</TD></TR>
  <TR>
    <TD>11</TD>
    <TD>      STRLEN key<BR>得到存储在键的值的长度</TD></TR>
  <TR>
    <TD>12</TD>
    <TD>      MSET key value [key value ...]<BR>设置多个键和多个值</TD></TR>
  <TR>
    <TD>13</TD>
    <TD>      MSETNX key value [key value 
    ...]&nbsp;<BR>设置多个键多个值，只有在当没有按键的存在时</TD></TR>
  <TR>
    <TD>14</TD>
    <TD>      PSETEX key milliseconds value<BR>设置键的毫秒值和到期时间</TD></TR>
  <TR>
    <TD>15</TD>
    <TD>      INCR key<BR>增加键的整数值一次</TD></TR>
  <TR>
    <TD>16</TD>
    <TD>      INCRBY key increment<BR>由给定的数量递增键的整数值</TD></TR>
  <TR>
    <TD>17</TD>
    <TD>      INCRBYFLOAT key increment<BR>由给定的数量递增键的浮点值</TD></TR>
  <TR>
    <TD>      18</TD>
    <TD>      DECR key<BR>递减键一次的整数值</TD></TR>
  <TR>
    <TD>19</TD>
    <TD>      DECRBY key decrement<BR>由给定数目递减键的整数值</TD></TR>
  <TR>
    <TD>20</TD>
    <TD>      APPEND key value<BR>追加值到一个键</TD></TR></TBODY></TABLE>
<HR style="border-width: 2px; border-color: lime;">

<DIV align="center">©copyright 版权所有   作者：zzy</DIV>
<SCRIPT src="../../pub/syntaxhighlighter/scripts/shCore.js" type="text/javascript"></SCRIPT>
 
<SCRIPT src="../../pub/syntaxhighlighter/scripts/shBrushJava.js" type="text/javascript"></SCRIPT>
	
<SCRIPT src="../../pub/syntaxhighlighter/scripts/shBrushJScript.js" type="text/javascript"></SCRIPT>
 
<SCRIPT src="../../pub/syntaxhighlighter/scripts/shBrushXml.js" type="text/javascript"></SCRIPT>
 
<SCRIPT src="../../pub/syntaxhighlighter/scripts/shBrushSql.js" type="text/javascript"></SCRIPT>
 
<SCRIPT src="../../pub/syntaxhighlighter/scripts/shBrushBash.js" type="text/javascript"></SCRIPT>
	
<SCRIPT src="../../pub/syntaxhighlighter/scripts/shBrushVb.js" type="text/javascript"></SCRIPT>
	
<SCRIPT src="../../pub/syntaxhighlighter/init.js" type="text/javascript"></SCRIPT>
 
<SCRIPT src="../../pub/js/jquery.tools.min.js" type="text/javascript"></SCRIPT>
 <!-- make all links with the 'rel' attribute open overlays --> 
<SCRIPT>
  $(function() {
      $("#apple img[rel]").overlay({effect: 'apple'});
    });
</SCRIPT>
 </DIV></BODY></HTML>
